package com.hong.listeners;

import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

//@Component
public class RedisMessageListener implements MessageListener {

    @Override
    public void onMessage(Message message, byte[] bytes) {
        String body = new String(message.getBody());
        String topic = new String(bytes);
        System.out.println("当前线程=" + Thread.currentThread().getName());
        System.out.println("消息体=" + body);
        System.out.println("主题=" + topic);

    }
}
